<?php

function getBlogActionList($course_id, $message=NULL) {
    $finalStr = "{list:{title:'Welcome to blogging', list_id:'blogActionList$course_id', items: [";
    $finalStr.="{id:'addBlogQuestion',label:'Create a topic'},{id:'viewBlogQuestions',label:'View topics'}";
    $finalStr.="]";
    if ($message) {
        $finalStr.=",message:{text:'$message'}";
    }
    $finalStr.="}}";
    return $finalStr;
}

function getViewBlogQuestion($blog_question_id, $message=NULL) {
    $question = new BlogQuestion($blog_question_id);
    $finalStr = "{form:{title:'View topic', form_id:'viewBlogQuestion$blog_question_id', items:[";
    $finalStr.= "{label:{text:'" . $question->question . " (" . $question->num_of_replies . " comments)'}},";
    $finalStr.= "{checkbox:{id:'addReply',label:'Add comment'}},";
    $finalStr.= getBlogReplies($blog_question_id);
    if ($message) {
        $finalStr.= ",{message:{text:'$message'}},";
    }
    $finalStr.="]}}";
    return $finalStr;
}

function getNotoficationsList($message=NULL) {
    $finalStr = "{list:{title:'Notifications', list_id:'notificationsList', items: [";
    $finalStr.=getUserNotifications();
    $finalStr.="]";
    if ($message) {
        $finalStr.=",message:{text:'$message'}";
    }
    $finalStr.="}}";
    return $finalStr;
}

function prepareLessonPage($lesson_id, $offset) {
    $title = getLesson($lesson_id);
    $page = getLessonPage($lesson_id, $offset, phoneNoToUserID($_GET['phone_number']));
    $finalStr = "";
    if ($page) {
        $finalStr.="{form:{title:'$title Page " . ($offset + 1) . "', form_id:'lessonContent$lesson_id" . Sympols::$split5 . "$page->page_id" . Sympols::$split5 . $offset . "', items:[";
        $finalStr.= "{label:{text:'" . $page->content . "'}},";
        $finalStr.="{button:{label:'Next'}} ";
        $finalStr.="]}}";
    } else {
        $finalStr.="{form:{title:'$title Lesson Done!', form_id:'lessonDone$lesson_id', items:[";
        $finalStr.="{label:{text:'You viewed all the pages in this lesson, click the back button to see the list of lessons!'}},";
        $finalStr.="]}}";
    }
    return $finalStr;
}

function getInteractionHome() {
    $finalStr = "{list:{title:'Select a course to blog about', list_id:'blogList', items: [";
    $finalStr.=getEnrolledCourses(phoneNoToUserID($_GET['phone_number']), TRUE, "all");
    $finalStr.="]}}";
    return $finalStr;
}

function getTerms() {
    return "It is with great pleasure that we introduce Common Discussion
Board through M-learning. Note that 'common' in this context means that
any M-learning user can participate in the topics posted, it is
not connected to any particular course. This remains an official
Learning Academy resource to promote information sharing while 
maintaining all integrity and ethical values.<br/>
You are being reminded to:<br/>
Observe all nettiquette for m-learning discussion forums<br/>
Use ENGLISH ONLY for all postings;
<br/>
Avoid vulgar and obscene language.<br/>
If you have anything personal to share with someone,
 use office email facility rather that the discussion forum.
To this effect, postings that are irrational, obscene and
offensive will be deleted and lead to a disciplinary action.
(Due to limited number of staff we are unable to monitor all
that goes on in the forum so let us all be our own monitors/policemen,
 responsible for our actions). Notify us of any abuse or misuse so we can
deal with the cases before getting out of hand.<br/>
Enjoy your M-learning.....";
}